import { ref, computed } from "vue";

import { defineStore } from "pinia";

export const use_app_state_store = defineStore(
  "app_state_store",
  () => {
    let headerState = ref({
      showBehavior: "autoHide,titleMode,transparentMode,",
      title: "welcome to",
      position: "fixed",
      bgc: "grey" || "transparent",
      color: "#dfdfdf",
      boxShadow: "0 0 30px rgba(0, 0, 0, .2)",
      transform: "translateY(0)",
    });

    let musicPlayerState = ref({
      offset: computed(() => {
        return headerState.value.transform === "translateY(0)" ? 50 : 0;
      }),
    });

    const navs = ref([
      {
        showName: "会议通知",
        type: "RouterLink",
        path: "/product",
        children: [
          {
            showName: "会议行程",
            path: "https://gitee.com/sunzr0119/convention-center-template",
            icon: {
              name: "page-template",
            },
            type: "a",
            target: "_blank",
          },
          {
            showName: "最新通知",
            path: "https://gitee.com/sunzr0119/convention-center-template",
            icon: {
              name: "pay-code-one",
            },
            type: "a",
            target: "_blank",
          },
          /* 尽管有该path，但该path没在router.js中注册，使用RouterLink是访问不了的，需在刷新一下 */
          // {showName: '首页模板(free)', path: '/public/pages/example/index/', type: 'RouterLink'},
          {
            showName: "首页通知",
            path: "https://gitee.com/sunzr0119/convention-center-template",
            icon: {
              name: "page-template",
            },
            type: "a",
          },
        ],
      },
      {
        showName: "文件公告",
        type: "RouterLink",
        path: "/demo",
        children: [
          {
            showName: "附件1(点击下载)",
            path: "/downloadFile",
            type: "RouterLink",
          },
          {
            showName: "附件2(点击下载)",
            path: "/downloadFile",
            type: "RouterLink",
          },
          {
            showName: "附件3(点击下载)",
            path: "/downloadFile",
            type: "RouterLink",
          },
          {
            showName: "附件4(点击下载)",
            path: "/downloadFile",
            type: "RouterLink",
          },
          {
            showName: "附件5(点击下载)",
            path: "/downloadFile",
            type: "RouterLink",
          },
          {
            showName: "附件6(点击下载)",
            path: "/downloadFile",
            type: "RouterLink",
            target: "_self",
          },
        ],
      },
      {
        showName: "素材下载",
        type: "a",
        target: "_blank",
        path: "https://gitee.com/sunzr0119/convention-center-template",
        icon: {
          name: "download", // Vant 下载图标
        },
      }
    ]);

    const audios = ref([
      {
        name: "卡农",
        url: "/src/assets/audio/kano.mp3",
      },
      {
        name: "总有一天你会出现在我身边",
        url: "/src/assets/audio/总有一天你会出现在我身边.mp3",
      },
      {
        name: "shed a light",
        url: "/src/assets/audio/ShedALight.mp3",
      },
      {
        name: "下雨天",
        url: "/src/assets/audio/下雨天.mp3",
      },
      {
        name: "song for a king",
        url: "/src/assets/audio/SongForAKing.mp3",
      },
      {
        name: "最后一页",
        url: "/src/assets/audio/最后一页.mp3",
      },
    ]);

    const contacts = ref([
      {
        name: "微信交流群",
        value: "709852732",
        iconName: "wechat",
        codeBean: {
          path: "/src/assets/img/contacts/ainow.jpg",
        },
      },
      {
        name: "QQ交流群",
        value: "709852732",
        iconName: "tencent-qq",
        codeBean: {
          path: "/src/assets/img/contacts/_valnow.jpg",
        },
      },
      {
        name: "邮箱",
        value: "1613882077@qq.com",
        iconName: "mail-open",
      },
      { name: "电话", value: "+86-none", iconName: "phone-telephone" },
      { name: "地址", value: "china, gd - xxxxxx", iconName: "local" },
    ]);

    const recommendItems = ref([
      {
        imgPath: "/src/assets/img/recommend/nnu.jpg",
        title: "南京师范大学",
        summary: "南京师范大学官网",
        detailPath: "https://www.njnu.edu.cn/",
        date: " https://www.njnu.edu.cn/",
        author: "南师大",
      },
      {
        imgPath: "/src/assets/img/recommend/dky.jpg",
        title: "南京师范大学地理科学学院",
        summary: "南京师范大学地理科学学院官网",
        detailPath: "https://dky.njnu.edu.cn/",
        date: " https://dky.njnu.edu.cn/ ",
        author: "地科院",
      },
      {
        imgPath: "/src/assets/img/recommend/team.png",
        title: "OpenGMSTeam",
        summary: "OpenGMSTeam团队官网",
        detailPath: "http://opengmsteam.com/",
        date: " http://opengmsteam.com/",
        author: "OpenGMS",
      },
    ]);

    return {
      headerState,
      musicPlayerState,
      navs,
      audios,
      contacts,
      recommendItems,
    };
  },
  {
    persist: false,
  }
);
